package com.common.core.utils;

import android.util.Log;

import com.common.core.CoreConfiguration;

/**
 * 日志工具
 * */
public class LogTool {

    public static final boolean DEBUG = CoreConfiguration.isDebug();

    /**
     * 错误级日志
     * */
    public static void e(String tag , String logMsg){
        if(DEBUG && LogLevelTool.curLevel.getCode() <= LogLevelTool.ERROR.getCode())
            Log.e(tag , logMsg);
    }

    /**
     * 错误级日志
     * */
    public static void e(String logMsg){
        e(LogTool.class.getName() , logMsg);
    }

    /**
     * 警告级日志
     * */
    public static void w(String tag , String logMsg){
        if(DEBUG && LogLevelTool.curLevel.getCode() <= LogLevelTool.WARN.getCode())
            Log.w(tag , logMsg);
    }

    /**
     * 警告级日志
     * */
    public static void w(String logMsg){
        w(LogTool.class.getName() , logMsg);
    }

    /**
     * 调试级日志
     * */
    public static void d(String tag , String logMsg){
        if(DEBUG && LogLevelTool.curLevel.getCode() <= LogLevelTool.DEBUG.getCode())
            Log.d(tag, logMsg);
    }

    /**
     * 调试级日志
     * */
    public static void d(String logMsg){
        d(LogTool.class.getName() , logMsg);
    }

    /**
     * 明细级日志
     * */
    public static void i(String tag , String logMsg){
        if(DEBUG && LogLevelTool.curLevel.getCode() <= LogLevelTool.DEBUG.getCode())
            Log.i(tag , logMsg);
    }

    /**
     * 明细级日志
     * */
    public static void i(String logMsg){
        i(LogTool.class.getName() , logMsg);
    }

}
